<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddTypeToProducts extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('products', function (Blueprint $table) {
            // $table->boolean('type')->default(false)->after('id')->index()->comment('是否为众筹商品 0不是 1是');
            $table->string('type')->after('id')->default(\App\Models\Product::TYPE_NORMAL)->index()->comment('众筹商品');
        });
        \DB::statement("ALTER TABLE `products` comment '商品表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn('type');
        });
    }
}
